sql_alarm = """  
        CREATE TABLE if not exists public.alarm_%s
        (
        maxalarm_level smallint,
        general_alarm_mark double precision,
        rechargefailed_count_n1 smallint,
        rechargefailed_code_list text,
        motorfailed_count_n2 smallint,
        motorfailed_code_list text,
        enginefailed_count_n3 smallint,
        enginefailed_list text,
        otherfailed_count_n4 smallint,
        otherfailed_list text,
        sample_time timestamp without time zone
        )
        WITH (
        OIDS=FALSE
        );
        ALTER TABLE public.alarm_%s
        OWNER TO postgres;
    """

sql_bulkcapacitortemperature = """  
    CREATE TABLE if not exists public.bulkcapacitortemperature_%s
    (
    subsystem_num smallint,
    temperature_probe_num integer,
    temperature_values text,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE public.bulkcapacitortemperature_%s
    OWNER TO postgres;
"""



sql_bulkcapacitorvoltage = """  
    CREATE TABLE if not exists public.bulkcapacitorvoltage_%s
    (
    subsystem_num smallint,
    rechargeable_energy_voltage double precision,
    rechargeable_energy_electricity double precision,
    battery_total_num integer,
    battery_sn integer,
    frame_battery_total_num smallint,
    battery_voltage text,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE public.bulkcapacitorvoltage_%s
    OWNER TO postgres;
"""

sql_drivemotor = """  
    CREATE TABLE if not exists public.drivemotor_%s
    (
    motor_serial smallint,
    motor_status smallint,
    motor_controller_humidity integer,
    motor_rev double precision,
    motor_torque double precision,
    motor_humidity smallint,
    motor_input_voltage double precision,
    motor_dcbus_current double precision,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE public.drivemotor_%s
    OWNER TO postgres;
"""



sql_extremum = """  
    CREATE TABLE if not exists public.extremum_%s
    (
    maxvoltage_subsystem smallint,
    highestvoltage_monomer smallint,
    cellvoltage_highest double precision,
    minvoltage_subsystem smallint,
    lowestvoltage_monomer smallint,
    cellvoltage_lowest double precision,
    maxtemper_subsystem smallint,
    maxtem_probecode smallint,
    max_temperature smallint,
    mintemper_subsystem smallint,
    mintem_probecode smallint,
    min_temperature smallint,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE public.extremum_%s
    OWNER TO postgres;
"""



sql_fuelcell = """  
    CREATE TABLE if not exists public.fuelcell_%s
    (
    fuel_voltage double precision,
    fuel_current double precision,
    fuel_rate double precision,
    fuel_temperature_total double precision,
    temperature_value text,
    hydrogen_maxtemperature double precision,
    hydrogen_maxtem_probecode integer,
    hydrogen_max_concentration double precision,
    hydrogen_maxconcen_sensor integer,
    hydrogen_max_pressure double precision,
    hydrogen_maxpress_sensor smallint,
    highdc_dcstatus smallint,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE  public.fuelcell_%s
    OWNER TO postgres;
"""



sql_gps = """  
    CREATE TABLE if not exists public.gps_%s
    (
    location_status integer,
    longitude double precision,
    latitude double precision,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE public.gps_%s
    OWNER TO postgres;
"""


sql_motor = """  
    CREATE TABLE if not exists public.motor_%s
    (
    engine_status smallint,
    speed_crankshaft double precision,
    fuel_rate double precision,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE public.motor_%s
    OWNER TO postgres;
"""


sql_vehicle = """  
    CREATE TABLE if not exists public.vehicle_%s
    (
    vehcile_status integer,
    recharge integer,
    running_mode integer,
    vehicle_speed double precision,
    accumulated_mileage double precision,
    total_voltage double precision,
    total_current double precision,
    soc integer,
    dc_dc_status integer,
    gears integer,
    insulation_resistance double precision,
    accelerator_pedal_values smallint,
    brake_pedal_status smallint,
    sample_time timestamp without time zone
    )
    WITH (
    OIDS=FALSE
    );
    ALTER TABLE public.vehicle_%s
    OWNER TO postgres;
"""